﻿using Ebusiness_Authservice.Services;
using Ebusiness_Authservice.Services.Dtos;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;

namespace Ebusiness_Authservice.Controllers
{
    /// <summary>
    /// 用户登录注册控制器
    /// </summary>
    //[ApiController]
    [Route("api/userservice/user/[action]")]
    public class UserController : AbpController, IApplicationUserService
    {
        public IApplicationUserService applicationUserService { get; set; }

        public UserController()
        {

        }

        /// <summary>
        /// 创建用户
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApplicationUserDto> CreateAsync(ApplicationUserDto input)
        {
            return await applicationUserService.CreateAsync(input);
        }

        [HttpDelete]
        public async Task DeleteAsync(Guid id)
        {
            await applicationUserService.DeleteAsync(id);
        }

        [HttpGet]
        public async Task<ApplicationUserDto> GetAsync(Guid id)
        {
            return await applicationUserService.GetAsync(id);
        }

        [HttpGet]
        public async Task<PagedResultDto<ApplicationUserDto>> GetListAsync(PagedAndSortedResultRequestDto input)
        {
            return await applicationUserService.GetListAsync(input);
        }

        [HttpPut]
        public async Task<ApplicationUserDto> UpdateAsync(Guid id, ApplicationUserDto input)
        {
            return await applicationUserService.UpdateAsync(id, input);
        }
    }
}
